<script setup>
import { reactive } from 'vue'
import useViewEvent from '@/core/hooks/useViewEvent'
import positionApi from '@/api/advert/PositionApi'


const state = reactive({ 
  visible: false,  
  loading: false, // 加载开关
})
// 表单结构
const original = {
  id: '',
  channelId: '',
  seat: '',
  sizeWidth: 1,
  sizeHeight: 1,
  notes: '',
}
// 表单数据
const formState = reactive({})

// 初始化数据
const { InitializeData } = useViewEvent({state: state, remoteFetchData: positionApi.getFormModelById, formState: formState, original: original })

//向父组件暴露方法和属性
defineExpose({ InitializeData })
</script>
<template>
  <a-drawer
    v-model:visible="state.visible"
    :title="`查看位置信息`"
    placement="right"
    :width="'50%'">
    <template #extra>
      <a-button type="link" @click="state.visible=false">关闭</a-button>
    </template>
    <a-card hoverable>
      <a-spin :spinning="state.loading">
        <a-descriptions :column="1" bordered>
          <a-descriptions-item label="频道">{{ formState.channelId }}</a-descriptions-item>
          <a-descriptions-item label="位置">{{ formState.seat }}</a-descriptions-item>
          <a-descriptions-item label="大小(宽)">{{ formState.sizeWidth }}</a-descriptions-item>
          <a-descriptions-item label="大小(高)">{{ formState.sizeHeight }}</a-descriptions-item>
          <a-descriptions-item label="备注">{{ formState.notes }}</a-descriptions-item>
        </a-descriptions>
      </a-spin>
    </a-card>
  </a-drawer>
</template>